import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/pxx_commodity/commodity/page',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getDetail = (id) => {
  return request({
    url: '/api/pxx_commodity/commodity/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/pxx_commodity/commodity/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/pxx_commodity/commodity/submits',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/pxx_commodity/commodity/submits',
    method: 'post',
    data: row
  })
}

export const history = (commodity) => {
  return request({
    url: '/api/pxx_commodity/commodity/history',
    method: 'post',
    data: commodity
  })
}

export const selectHistory = () => {
  return request({
    url: '/api/pxx_commodity/commodity/selectHistory',
    method: 'get',
  })
}

export const commodityPage = (current, size, params) => {
  return request({
    url: '/api/pxx_commodity/commodity/commodityPage',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}


export const getCommodityDetail = (id) => {
  return request({
    url: '/api/pxx_commodity/commodity/getCommodityDetail',
    method: 'get',
    params: {
      id
    }
  })
}
